package com.example.consumer2.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

/**
 * Created with IntelliJ IDEA 2023.
 * Description:
 * User: 故我
 * Date: 2024-01-14
 * Time: 9:38
 */
@RestController
@RequestMapping("/user")
public class UserController {
    @Autowired
    private RestTemplate restTemplate;

    @RequestMapping("/getnamebyid")
    public String getNameById(Integer id) {
        return restTemplate.getForObject("http://nacos-discovery-demo/user/getuserbyid?id=" + id, String.class);
    }
}
